package com.example.js_interaction.localweb;

import android.content.Context;
import android.webkit.JavascriptInterface;
import android.widget.Toast;

public class LocalJavaScript {
    Context context;

    /**
     * 初始化类
     * @param context
     */
    public LocalJavaScript(Context context){
        this.context = context;
    }
    //ja调用Android必须有  @JavascriptInterface   代表注入接口
    @JavascriptInterface
    public String callFromJS(String str){
        Toast.makeText(context,"调用了Android当中的函数" + str,Toast.LENGTH_SHORT).show();
        return str;
    }
}
